2020-12-12 14:13:38 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
- hosts: localhost
|
|
|
|
connection: local
|
|
|
|
vars:
|
|
|
|
force_purge: true
|
|
|
|
roles_installation_dir: roles/public
|
|
|
|
collection_installation_dir: collections
|
|
|
|
installation_prefix: ../
|
|
|
|
pre_tasks:
|
2021-08-30 05:02:24 +00:00
|
|
|
# example prepare ansible box for execution
|
|
|
|
# - name: install required pip modules on the host running ansible
|
|
|
|
# pip:
|
|
|
|
# name:
|
|
|
|
# - jmespath
|
|
|
|
# - netaddr
|
|
|
|
# - python-consul
|
|
|
|
# - pyvmomi
|
|
|
|
# - python-ldap
|
|
|
|
# - twine
|
2020-12-12 14:13:38 +00:00
|
|
|
|
|
|
|
- name: Remove existing public roles
|
|
|
|
file:
|
|
|
|
path: "{{ installation_prefix }}{{ roles_installation_dir }}"
|
|
|
|
state: absent
|
|
|
|
when: force_purge | bool
|
|
|
|
|
|
|
|
- name: Install all public roles
|
|
|
|
command: >
|
|
|
|
ansible-galaxy role install
|
|
|
|
{{ ( force_purge | bool ) | ternary('--force','') }}
|
|
|
|
--role-file {{ installation_prefix }}roles/requirements.yml
|
|
|
|
--roles-path {{ installation_prefix }}{{ roles_installation_dir }}
|
2020-12-14 01:42:30 +00:00
|
|
|
register: galaxy_install_role
|
|
|
|
changed_when: '"Installing " in galaxy_install_role.stdout'
|
2020-12-12 14:13:38 +00:00
|
|
|
|
|
|
|
- name: Install needed collections
|
|
|
|
command: >
|
|
|
|
ansible-galaxy collection install
|
|
|
|
{{ ( force_purge | bool ) | ternary('--force-with-deps','') }}
|
2022-04-10 18:23:02 +00:00
|
|
|
-r {{ installation_prefix }}collections/requirements.yml
|
2020-12-12 14:13:38 +00:00
|
|
|
-p {{ installation_prefix }}{{ collection_installation_dir }}
|
2020-12-14 01:42:30 +00:00
|
|
|
register: galaxy_install_collection
|
|
|
|
changed_when: '"Installing " in galaxy_install_collection.stdout'
|
2020-12-12 14:13:38 +00:00
|
|
|
|
2020-12-12 18:46:20 +00:00
|
|
|
- name: cleanup old ssh known_hosts - remove
|
2020-12-12 14:13:38 +00:00
|
|
|
file:
|
|
|
|
path: "../tmp/known_hosts"
|
|
|
|
state: absent
|
2020-12-12 18:46:20 +00:00
|
|
|
mode: "0644"
|
|
|
|
|
|
|
|
- name: cleanup old ssh known_hosts - blank
|
|
|
|
file:
|
2020-12-12 14:13:38 +00:00
|
|
|
path: "../tmp/known_hosts"
|
|
|
|
state: touch
|
2020-12-12 18:46:20 +00:00
|
|
|
mode: "0644"
|
2021-08-30 05:02:24 +00:00
|
|
|
...
|