1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_packages.git synced 2024-08-16 10:19:51 +02:00

Update ansible syntax to new naming scheme

This commit is contained in:
L3D 2021-03-12 22:18:54 +01:00
parent 710f6889a9
commit d8082fc819
Signed by: l3d
GPG key ID: CD08445BFF4313D1
14 changed files with 98 additions and 50 deletions

View file

@ -2,7 +2,13 @@
name: Ansible check debian:stable name: Ansible check debian:stable
# yamllint disable-line rule:truthy # yamllint disable-line rule:truthy
on: [push, pull_request] on:
push:
branches: '*'
pull_request:
branches: '*'
schedule:
- cron: '23 6 * */1 *'
jobs: jobs:
build: build:

View file

@ -2,7 +2,13 @@
name: Ansible Lint check name: Ansible Lint check
# yamllint disable-line rule:truthy # yamllint disable-line rule:truthy
on: [push, pull_request] on:
push:
branches: '*'
pull_request:
branches: '*'
schedule:
- cron: '42 6 * */1 *'
jobs: jobs:
build: build:

20
.github/workflows/galaxy.yml vendored Normal file
View 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 }}

View file

@ -2,7 +2,13 @@
name: 'Yamllint GitHub Actions' name: 'Yamllint GitHub Actions'
# yamllint disable-line rule:truthy # yamllint disable-line rule:truthy
on: [push, pull_request] on:
push:
branches: '*'
pull_request:
branches: '*'
schedule:
- cron: '23 6 * */1 *'
jobs: jobs:
yamllint: yamllint:
@ -16,7 +22,3 @@ jobs:
with: with:
yamllint_file_or_dir: '.' yamllint_file_or_dir: '.'
yamllint_config_filepath: './.yamllint' yamllint_config_filepath: './.yamllint'
yamllint_strict: false
yamllint_comment: true
# env:
# GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.cache

View file

@ -1,10 +1,10 @@
--- ---
galaxy_info: galaxy_info:
author: L3D author: do1jlr
description: Ansible role to install some base packages and make some base configuration on all common linux systems description: Ansible role to install some base packages and make some base configuration on all common linux systems
role_name: base role_name: base
license: MIT license: MIT
min_ansible_version: 2.6 min_ansible_version: 2.8
github_branch: master github_branch: master
platforms: platforms:
- name: Archlinux - name: Archlinux

View file

@ -1,7 +1,7 @@
--- ---
- name: vim is our editor - name: vim is our editor
become: true become: true
alternatives: community.general.alternatives:
name: editor name: editor
path: /usr/bin/vim.basic path: /usr/bin/vim.basic
when: when:
@ -13,7 +13,7 @@
- name: vim is our editor - name: vim is our editor
become: true become: true
alternatives: community.general.alternatives:
name: editor name: editor
path: /usr/bin/vim path: /usr/bin/vim
when: when:

View file

@ -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 - name: install keychain to support ssh agent
become: true become: true
package: ansible.builtin.package:
name: keychain name: keychain
state: "{{ base__package_state }}" state: "{{ base__package_state }}"
when: when:
@ -9,7 +16,7 @@
- name: install keychain on centos - name: install keychain on centos
become: true become: true
yum: ansible.builtin.yum:
name: name:
- "{{ _base__keychain_rpm }}" - "{{ _base__keychain_rpm }}"
- libselinux-python - libselinux-python

View file

@ -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 when: print_os_vars | bool
- include_tasks: versioncheck.yml - name: optional versionscheck
ansible.builtin.include_tasks: versioncheck.yml
when: submodules_versioncheck | bool when: submodules_versioncheck | bool
- include_tasks: sources.yml - name: optional add apt sources
ansible.builtin.include_tasks: sources.yml
when: when:
- base__add_ethz | bool - base__add_ethz | bool
- ansible_architecture == 'x86_64' - 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 - name: Upgrade all packages to latest
become: true become: true
package: ansible.builtin.package:
name: "*" name: "*"
state: "{{ base__package_state }}" state: "{{ base__package_state }}"
when: when:
- base__upgrade_packages_to_latest_version|bool - 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 when: base__install_vim | bool
- include_tasks: keychain.yml - name: optional install keychain
ansible.builtin.include_tasks: keychain.yml
when: base__install_keychain | bool when: base__install_keychain | bool

View file

@ -1,6 +1,6 @@
--- ---
- name: Print OS Infos - name: Print OS Infos
debug: ansible.builtin.debug:
msg: | msg: |
ansible_os_family = '{{ ansible_os_family }}' ansible_os_family = '{{ ansible_os_family }}'
ansible_distribution = '{{ ansible_distribution }}' ansible_distribution = '{{ ansible_distribution }}'

View file

@ -1,28 +1,28 @@
--- ---
- name: update repo-cache for debian/ubuntu - name: update repo-cache for debian/ubuntu
become: true become: true
apt: ansible.builtin.apt:
update_cache: true update_cache: true
cache_valid_time: 3600 cache_valid_time: 3600
when: when:
ansible_os_family == 'Debian' - ansible_pkg_mgr == "apt"
- name: update repo-cache for debian/ubuntu - name: update repo-cache for debian/ubuntu
become: true become: true
dnf: ansible.builtin.dnf:
update_cache: true update_cache: true
when: when:
- ansible_os_family == 'RedHat' and ansible_distribution_version | float >= 8 - ansible_os_family == 'RedHat' and ansible_distribution_version | float >= 8
- name: install base packages for all operating systems - name: install base packages for all operating systems
become: true become: true
package: ansible.builtin.package:
name: "{{ base__packages }}" name: "{{ base__packages }}"
state: "{{ base__package_state }}" state: "{{ base__package_state }}"
- name: install python3 for all non-legacy systems - name: install python3 for all non-legacy systems
become: true become: true
package: ansible.builtin.package:
name: "{{ base__python3_packages }}" name: "{{ base__python3_packages }}"
state: "{{ base__package_state }}" state: "{{ base__package_state }}"
when: | when: |
@ -32,14 +32,14 @@
- name: install python for systems where python3 packages are renamed to python - name: install python for systems where python3 packages are renamed to python
become: true become: true
package: ansible.builtin.package:
name: "{{ base__python_packages }}" name: "{{ base__python_packages }}"
state: "{{ base__package_state }}" state: "{{ base__package_state }}"
when: ansible_os_family == 'Archlinux' when: ansible_os_family == 'Archlinux'
- name: install packages for all non-legacy systems - name: install packages for all non-legacy systems
become: true become: true
package: ansible.builtin.package:
name: "{{ base__modern_packages }}" name: "{{ base__modern_packages }}"
state: "{{ base__package_state }}" state: "{{ base__package_state }}"
when: | when: |
@ -50,7 +50,7 @@
- name: install packages for all non-legacy Debian/Ububntu systems - name: install packages for all non-legacy Debian/Ububntu systems
become: true become: true
package: ansible.builtin.package:
name: "{{ base__debian_packages }}" name: "{{ base__debian_packages }}"
state: "{{ base__package_state }}" state: "{{ base__package_state }}"
when: | when: |
@ -59,7 +59,7 @@
- name: install packages for all reasonable non-legacy systems - name: install packages for all reasonable non-legacy systems
become: true become: true
package: ansible.builtin.package:
name: "{{ base__linux_packages }}" name: "{{ base__linux_packages }}"
state: "{{ base__package_state }}" state: "{{ base__package_state }}"
when: | when: |
@ -70,7 +70,7 @@
- name: install mailx on debian - name: install mailx on debian
become: true become: true
package: ansible.builtin.package:
name: name:
- bsd-mailx - bsd-mailx
state: "{{ base__package_state }}" state: "{{ base__package_state }}"

View file

@ -1,16 +1,15 @@
--- ---
- name: update repo-cache for Debian/Ubuntu - name: update repo-cache for Debian/Ubuntu
become: true become: true
apt: ansible.builtin.apt:
update_cache: true update_cache: true
cache_valid_time: 3600 cache_valid_time: 3600
when: when:
ansible_os_family == 'Debian' - ansible_pkg_mgr == "apt"
- name: Install requirements to add packages - name: Install requirements to add packages
become: true become: true
apt: ansible.builtin.apt:
package: package:
- debian-goodies - debian-goodies
- apt-dater-host - apt-dater-host
@ -19,8 +18,8 @@
- name: add eth zurich apt (main) - name: add eth zurich apt (main)
become: true become: true
apt_repository: ansible.builtin.apt_repository:
repo: deb https://debian.ethz.ch/debian/ {{ ansible_distribution_release }} main repo: "deb https://debian.ethz.ch/debian/ {{ ansible_distribution_release }} main"
state: present state: present
mode: 0644 mode: 0644
when: when:
@ -29,8 +28,8 @@
- name: add eth zurich apt (main non-free) - name: add eth zurich apt (main non-free)
become: true become: true
apt_repository: ansible.builtin.apt_repository:
repo: deb-src https://debian.ethz.ch/debian/ {{ ansible_distribution_release }} main non-free repo: "deb-src https://debian.ethz.ch/debian/ {{ ansible_distribution_release }} main non-free"
state: present state: present
mode: 0644 mode: 0644
when: when:
@ -39,8 +38,8 @@
- name: add eth zurich apt (main contrib non-free) - name: add eth zurich apt (main contrib non-free)
become: true become: true
apt_repository: ansible.builtin.apt_repository:
repo: deb-src https://debian.ethz.ch/debian/ {{ ansible_distribution_release }} main contrib non-free repo: "deb-src https://debian.ethz.ch/debian/ {{ ansible_distribution_release }} main contrib non-free"
state: present state: present
mode: 0644 mode: 0644
when: when:

View file

@ -1,7 +1,7 @@
--- ---
- name: Create directory for versionscheck - name: Create directory for versionscheck
become: true become: true
file: ansible.builtin.file:
path: '/etc/.ansible-version' path: '/etc/.ansible-version'
state: directory state: directory
mode: 0755 mode: 0755
@ -9,7 +9,7 @@
- name: check playbook version - name: check playbook version
become: true become: true
slurp: ansible.builtin.slurp:
src: "/etc/.ansible-version/{{ playbook_version_path }}" src: "/etc/.ansible-version/{{ playbook_version_path }}"
register: playbook_version register: playbook_version
when: submodules_versioncheck|bool when: submodules_versioncheck|bool
@ -17,29 +17,29 @@
failed_when: false failed_when: false
- name: Print remote role version - name: Print remote role version
debug: ansible.builtin.debug:
msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}" msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}"
when: submodules_versioncheck|bool when: submodules_versioncheck|bool
- name: Print locale role version - name: Print locale role version
debug: ansible.builtin.debug:
msg: "Local role version: '{{ playbook_version_number|string }}'." msg: "Local role version: '{{ playbook_version_number|string }}'."
when: submodules_versioncheck|bool when: submodules_versioncheck|bool
- name: Check if your version is outdated - 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!" msg: "Your ansible module has the version '{{ playbook_version_number }}' and is outdated. You need to update it!"
when: when:
- playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck|bool - playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck|bool
- name: check if '/etc/ansible-version/' is empty - name: check if '/etc/ansible-version/' is empty
find: ansible.builtin.find:
paths: '/etc/ansible-version/' paths: '/etc/ansible-version/'
register: filesFound register: filesFound
- name: write new version to remote disk - name: write new version to remote disk
become: true become: true
copy: ansible.builtin.copy:
content: "{{ playbook_version_number }}" content: "{{ playbook_version_number }}"
dest: "/etc/.ansible-version/{{ playbook_version_path }}" dest: "/etc/.ansible-version/{{ playbook_version_path }}"
mode: '0644' mode: '0644'

View file

@ -61,5 +61,5 @@ base__linux_packages:
- bzip2 - bzip2
- jq - jq
playbook_version_number: 9007 playbook_version_number: 9008
playbook_version_path: 'base-packages_roles-ansible_github.version' playbook_version_path: 'base-packages_roles-ansible_github.version'