Add a tmp folder for init

This commit is contained in:
nazunalika 2022-06-03 19:56:40 -07:00
parent 2d6d4a125c
commit fd5c3acb95
Signed by: label
GPG Key ID: 6735C0E1BD65D048
4 changed files with 47 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
ansible.cfg

46
init-ansible-host.yml Normal file
View File

@ -0,0 +1,46 @@
---
# YOU SHOULD ONLY RUN THIS IF YOU ARE USING THIS LOCALLY. DO NOT RUN IN AWX.
- hosts: localhost
connection: local
vars:
force_purge: true
roles_installation_dir: roles/public
collection_installation_dir: collections
installation_prefix: ./
pre_tasks:
- name: Remove existing public roles
file:
path: "{{ installation_prefix }}{{ roles_installation_dir }}"
state: absent
when: force_purge | bool
- name: Install all public roles and collections
command: >
ansible-galaxy role install
{{ ( force_purge | bool ) | ternary('--force','') }}
--role-file {{ installation_prefix }}roles/requirements.yml
--roles-path {{ installation_prefix }}{{ roles_installation_dir }}
register: galaxy_install_role
changed_when: '"Installing " in galaxy_install_role.stdout'
- name: Install needed collections
command: >
ansible-galaxy collection install
{{ ( force_purge | bool ) | ternary('--force-with-deps','') }}
-r {{ installation_prefix }}collections/requirements.yml
-p {{ installation_prefix }}{{ collection_installation_dir }}
register: galaxy_install_collection
changed_when: '"Installing " in galaxy_install_collection.stdout'
- name: cleanup old ssh known_hosts - remove
file:
path: "./tmp/known_hosts"
state: absent
mode: "0644"
- name: cleanup old ssh known_hosts - blank
file:
path: "./tmp/known_hosts"
state: touch
mode: "0644"
...

0
tmp/tmp Normal file
View File