Prepare for multiple inventories
This commit is contained in:
parent
de4acaa6f2
commit
47e10569f8
8
infrastructure.ini
Normal file
8
infrastructure.ini
Normal file
|
@ -0,0 +1,8 @@
|
|||
[control_infra]
|
||||
sapt-labx-ctl01
|
||||
|
||||
[controlservers:children]
|
||||
control_infra
|
||||
|
||||
[infrastructure:children]
|
||||
controlservers
|
12
infrastructure.yml
Normal file
12
infrastructure.yml
Normal file
|
@ -0,0 +1,12 @@
|
|||
# vim: ft=yaml.ansible
|
||||
# code: language=ansible
|
||||
---
|
||||
- name: Run playbook
|
||||
hosts: all
|
||||
become: true
|
||||
gather_facts: true
|
||||
tasks:
|
||||
- name: Include role 'ctl-common'
|
||||
ansible.builtin.include_role:
|
||||
name: ctl-common
|
||||
when: hostname in groups['controlservers']
|
|
@ -22,9 +22,6 @@ sapt-labr-prx01
|
|||
# [monitor_shrd]
|
||||
# sapt-labr-mon01
|
||||
|
||||
# [control_infra]
|
||||
# sapt-labx-ctl01
|
||||
|
||||
[production:children]
|
||||
app_prod
|
||||
db_prod
|
||||
|
@ -61,6 +58,3 @@ proxy_shrd
|
|||
production
|
||||
staging
|
||||
shared
|
||||
|
||||
# [infrastructure:children]
|
||||
# control_infra
|
||||
|
|
1
site.yml
1
site.yml
|
@ -3,7 +3,6 @@
|
|||
---
|
||||
- name: Run playbook
|
||||
hosts: all
|
||||
remote_user: ansible
|
||||
become: true
|
||||
gather_facts: true
|
||||
tasks:
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [[ $1 == "-i" ]]; then
|
||||
ARGS="-i $2"
|
||||
shift 2
|
||||
fi
|
||||
|
||||
HOSTS="$1"
|
||||
CMD="$2"
|
||||
|
||||
ansible -b -u ansible -m shell -a "$CMD" "$HOSTS"
|
||||
eval "ansible $ARGS -b -m shell -a \"$CMD\" \"$HOSTS\""
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [[ $1 == "-i" ]]; then
|
||||
ARGS="-i $2"
|
||||
shift 2
|
||||
fi
|
||||
|
||||
HOSTS="$1"
|
||||
|
||||
ansible -b -u ansible -m reboot "$HOSTS"
|
||||
eval "ansible $ARGS -b -m reboot \"$HOSTS\""
|
||||
|
|
Loading…
Reference in a new issue