mirror of
https://github.com/roles-ansible/ansible_role_base.git
synced 2024-08-16 14:29:50 +02:00
Update ansible syntax to new naming scheme
This commit is contained in:
parent
710f6889a9
commit
d8082fc819
14 changed files with 98 additions and 50 deletions
8
.github/workflows/ansible-debian-stable.yml
vendored
8
.github/workflows/ansible-debian-stable.yml
vendored
|
@ -2,7 +2,13 @@
|
|||
name: Ansible check debian:stable
|
||||
|
||||
# yamllint disable-line rule:truthy
|
||||
on: [push, pull_request]
|
||||
on:
|
||||
push:
|
||||
branches: '*'
|
||||
pull_request:
|
||||
branches: '*'
|
||||
schedule:
|
||||
- cron: '23 6 * */1 *'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
|
8
.github/workflows/ansible-linting-check.yml
vendored
8
.github/workflows/ansible-linting-check.yml
vendored
|
@ -2,7 +2,13 @@
|
|||
name: Ansible Lint check
|
||||
|
||||
# yamllint disable-line rule:truthy
|
||||
on: [push, pull_request]
|
||||
on:
|
||||
push:
|
||||
branches: '*'
|
||||
pull_request:
|
||||
branches: '*'
|
||||
schedule:
|
||||
- cron: '42 6 * */1 *'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
|
20
.github/workflows/galaxy.yml
vendored
Normal file
20
.github/workflows/galaxy.yml
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
name: Galaxy release
|
||||
|
||||
# yamllint disable-line rule:truthy
|
||||
on:
|
||||
push:
|
||||
branches: ['main']
|
||||
release:
|
||||
types: ['created']
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: galaxy
|
||||
uses: robertdebock/galaxy-action@1.1.0
|
||||
with:
|
||||
galaxy_api_key: ${{ secrets.galaxy_api_key }}
|
12
.github/workflows/yamllint.yaml
vendored
12
.github/workflows/yamllint.yaml
vendored
|
@ -2,7 +2,13 @@
|
|||
name: 'Yamllint GitHub Actions'
|
||||
|
||||
# yamllint disable-line rule:truthy
|
||||
on: [push, pull_request]
|
||||
on:
|
||||
push:
|
||||
branches: '*'
|
||||
pull_request:
|
||||
branches: '*'
|
||||
schedule:
|
||||
- cron: '23 6 * */1 *'
|
||||
|
||||
jobs:
|
||||
yamllint:
|
||||
|
@ -16,7 +22,3 @@ jobs:
|
|||
with:
|
||||
yamllint_file_or_dir: '.'
|
||||
yamllint_config_filepath: './.yamllint'
|
||||
yamllint_strict: false
|
||||
yamllint_comment: true
|
||||
# env:
|
||||
# GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }
|
||||
|
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.cache
|
|
@ -1,10 +1,10 @@
|
|||
---
|
||||
galaxy_info:
|
||||
author: L3D
|
||||
author: do1jlr
|
||||
description: Ansible role to install some base packages and make some base configuration on all common linux systems
|
||||
role_name: base
|
||||
license: MIT
|
||||
min_ansible_version: 2.6
|
||||
min_ansible_version: 2.8
|
||||
github_branch: master
|
||||
platforms:
|
||||
- name: Archlinux
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
- name: vim is our editor
|
||||
become: true
|
||||
alternatives:
|
||||
community.general.alternatives:
|
||||
name: editor
|
||||
path: /usr/bin/vim.basic
|
||||
when:
|
||||
|
@ -13,7 +13,7 @@
|
|||
|
||||
- name: vim is our editor
|
||||
become: true
|
||||
alternatives:
|
||||
community.general.alternatives:
|
||||
name: editor
|
||||
path: /usr/bin/vim
|
||||
when:
|
||||
|
|
|
@ -1,7 +1,14 @@
|
|||
---
|
||||
- name: Update apt cache
|
||||
ansible.builtin.apt:
|
||||
cache_valid_time: 3600
|
||||
update_cache: true
|
||||
when:
|
||||
- ansible_pkg_mgr == "apt"
|
||||
|
||||
- name: install keychain to support ssh agent
|
||||
become: true
|
||||
package:
|
||||
ansible.builtin.package:
|
||||
name: keychain
|
||||
state: "{{ base__package_state }}"
|
||||
when:
|
||||
|
@ -9,7 +16,7 @@
|
|||
|
||||
- name: install keychain on centos
|
||||
become: true
|
||||
yum:
|
||||
ansible.builtin.yum:
|
||||
name:
|
||||
- "{{ _base__keychain_rpm }}"
|
||||
- libselinux-python
|
||||
|
|
|
@ -1,28 +1,35 @@
|
|||
---
|
||||
- include_tasks: os_info.yml
|
||||
- name: optional print os infos
|
||||
ansible.builtin.include_tasks: os_info.yml
|
||||
when: print_os_vars | bool
|
||||
|
||||
- include_tasks: versioncheck.yml
|
||||
- name: optional versionscheck
|
||||
ansible.builtin.include_tasks: versioncheck.yml
|
||||
when: submodules_versioncheck | bool
|
||||
|
||||
- include_tasks: sources.yml
|
||||
- name: optional add apt sources
|
||||
ansible.builtin.include_tasks: sources.yml
|
||||
when:
|
||||
- base__add_ethz | bool
|
||||
- ansible_architecture == 'x86_64'
|
||||
- ansible_distribution == 'Debian' and ansible_distribution_version | float >= 8
|
||||
- ansible_os_family == 'Debian' and ansible_distribution_version | float >= 8
|
||||
- ansible_pkg_mgr == "apt"
|
||||
|
||||
- include_tasks: packages.yml
|
||||
- name: install packages
|
||||
ansible.builtin.include_tasks: packages.yml
|
||||
|
||||
- name: Upgrade all packages to latest
|
||||
become: true
|
||||
package:
|
||||
ansible.builtin.package:
|
||||
name: "*"
|
||||
state: "{{ base__package_state }}"
|
||||
when:
|
||||
- base__upgrade_packages_to_latest_version|bool
|
||||
|
||||
- include_tasks: editor.yml
|
||||
- name: optional configure editor
|
||||
ansible.builtin.include_tasks: editor.yml
|
||||
when: base__install_vim | bool
|
||||
|
||||
- include_tasks: keychain.yml
|
||||
- name: optional install keychain
|
||||
ansible.builtin.include_tasks: keychain.yml
|
||||
when: base__install_keychain | bool
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
- name: Print OS Infos
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: |
|
||||
ansible_os_family = '{{ ansible_os_family }}'
|
||||
ansible_distribution = '{{ ansible_distribution }}'
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
---
|
||||
- name: update repo-cache for debian/ubuntu
|
||||
become: true
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
update_cache: true
|
||||
cache_valid_time: 3600
|
||||
when:
|
||||
ansible_os_family == 'Debian'
|
||||
- ansible_pkg_mgr == "apt"
|
||||
|
||||
- name: update repo-cache for debian/ubuntu
|
||||
become: true
|
||||
dnf:
|
||||
ansible.builtin.dnf:
|
||||
update_cache: true
|
||||
when:
|
||||
- ansible_os_family == 'RedHat' and ansible_distribution_version | float >= 8
|
||||
|
||||
- name: install base packages for all operating systems
|
||||
become: true
|
||||
package:
|
||||
ansible.builtin.package:
|
||||
name: "{{ base__packages }}"
|
||||
state: "{{ base__package_state }}"
|
||||
|
||||
- name: install python3 for all non-legacy systems
|
||||
become: true
|
||||
package:
|
||||
ansible.builtin.package:
|
||||
name: "{{ base__python3_packages }}"
|
||||
state: "{{ base__package_state }}"
|
||||
when: |
|
||||
|
@ -32,14 +32,14 @@
|
|||
|
||||
- name: install python for systems where python3 packages are renamed to python
|
||||
become: true
|
||||
package:
|
||||
ansible.builtin.package:
|
||||
name: "{{ base__python_packages }}"
|
||||
state: "{{ base__package_state }}"
|
||||
when: ansible_os_family == 'Archlinux'
|
||||
|
||||
- name: install packages for all non-legacy systems
|
||||
become: true
|
||||
package:
|
||||
ansible.builtin.package:
|
||||
name: "{{ base__modern_packages }}"
|
||||
state: "{{ base__package_state }}"
|
||||
when: |
|
||||
|
@ -50,7 +50,7 @@
|
|||
|
||||
- name: install packages for all non-legacy Debian/Ububntu systems
|
||||
become: true
|
||||
package:
|
||||
ansible.builtin.package:
|
||||
name: "{{ base__debian_packages }}"
|
||||
state: "{{ base__package_state }}"
|
||||
when: |
|
||||
|
@ -59,7 +59,7 @@
|
|||
|
||||
- name: install packages for all reasonable non-legacy systems
|
||||
become: true
|
||||
package:
|
||||
ansible.builtin.package:
|
||||
name: "{{ base__linux_packages }}"
|
||||
state: "{{ base__package_state }}"
|
||||
when: |
|
||||
|
@ -70,7 +70,7 @@
|
|||
|
||||
- name: install mailx on debian
|
||||
become: true
|
||||
package:
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- bsd-mailx
|
||||
state: "{{ base__package_state }}"
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
---
|
||||
- name: update repo-cache for Debian/Ubuntu
|
||||
become: true
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
update_cache: true
|
||||
cache_valid_time: 3600
|
||||
when:
|
||||
ansible_os_family == 'Debian'
|
||||
|
||||
- ansible_pkg_mgr == "apt"
|
||||
|
||||
- name: Install requirements to add packages
|
||||
become: true
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
package:
|
||||
- debian-goodies
|
||||
- apt-dater-host
|
||||
|
@ -19,8 +18,8 @@
|
|||
|
||||
- name: add eth zurich apt (main)
|
||||
become: true
|
||||
apt_repository:
|
||||
repo: deb https://debian.ethz.ch/debian/ {{ ansible_distribution_release }} main
|
||||
ansible.builtin.apt_repository:
|
||||
repo: "deb https://debian.ethz.ch/debian/ {{ ansible_distribution_release }} main"
|
||||
state: present
|
||||
mode: 0644
|
||||
when:
|
||||
|
@ -29,8 +28,8 @@
|
|||
|
||||
- name: add eth zurich apt (main non-free)
|
||||
become: true
|
||||
apt_repository:
|
||||
repo: deb-src https://debian.ethz.ch/debian/ {{ ansible_distribution_release }} main non-free
|
||||
ansible.builtin.apt_repository:
|
||||
repo: "deb-src https://debian.ethz.ch/debian/ {{ ansible_distribution_release }} main non-free"
|
||||
state: present
|
||||
mode: 0644
|
||||
when:
|
||||
|
@ -39,8 +38,8 @@
|
|||
|
||||
- name: add eth zurich apt (main contrib non-free)
|
||||
become: true
|
||||
apt_repository:
|
||||
repo: deb-src https://debian.ethz.ch/debian/ {{ ansible_distribution_release }} main contrib non-free
|
||||
ansible.builtin.apt_repository:
|
||||
repo: "deb-src https://debian.ethz.ch/debian/ {{ ansible_distribution_release }} main contrib non-free"
|
||||
state: present
|
||||
mode: 0644
|
||||
when:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
- name: Create directory for versionscheck
|
||||
become: true
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: '/etc/.ansible-version'
|
||||
state: directory
|
||||
mode: 0755
|
||||
|
@ -9,7 +9,7 @@
|
|||
|
||||
- name: check playbook version
|
||||
become: true
|
||||
slurp:
|
||||
ansible.builtin.slurp:
|
||||
src: "/etc/.ansible-version/{{ playbook_version_path }}"
|
||||
register: playbook_version
|
||||
when: submodules_versioncheck|bool
|
||||
|
@ -17,29 +17,29 @@
|
|||
failed_when: false
|
||||
|
||||
- name: Print remote role version
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}"
|
||||
when: submodules_versioncheck|bool
|
||||
|
||||
- name: Print locale role version
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "Local role version: '{{ playbook_version_number|string }}'."
|
||||
when: submodules_versioncheck|bool
|
||||
|
||||
- name: Check if your version is outdated
|
||||
fail:
|
||||
ansible.builtin.fail:
|
||||
msg: "Your ansible module has the version '{{ playbook_version_number }}' and is outdated. You need to update it!"
|
||||
when:
|
||||
- playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck|bool
|
||||
|
||||
- name: check if '/etc/ansible-version/' is empty
|
||||
find:
|
||||
ansible.builtin.find:
|
||||
paths: '/etc/ansible-version/'
|
||||
register: filesFound
|
||||
|
||||
- name: write new version to remote disk
|
||||
become: true
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
content: "{{ playbook_version_number }}"
|
||||
dest: "/etc/.ansible-version/{{ playbook_version_path }}"
|
||||
mode: '0644'
|
||||
|
|
|
@ -61,5 +61,5 @@ base__linux_packages:
|
|||
- bzip2
|
||||
- jq
|
||||
|
||||
playbook_version_number: 9007
|
||||
playbook_version_number: 9008
|
||||
playbook_version_path: 'base-packages_roles-ansible_github.version'
|
||||
|
|
Loading…
Reference in a new issue