-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.yml
69 lines (61 loc) · 1.73 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
- import_playbook: playbooks/provision_vms.yml
- hosts: all
become: yes
gather_facts: no
strategy: free
vars_files:
- vars/environment.yml
tasks:
- name: Configure ssh between hosts using generated ssh keys
vars:
host_dir: "{{ playbook_dir }}/.hosts"
include_role:
name: ssh
- name: Check if node is already registered to RHSM if necessary
command: subscription-manager status
register: rhsm_status
changed_when: false
failed_when: false
when: host_image.os == 'rhel'
- name: Register to rhsm and attach pool if necessary
redhat_subscription:
username: "{{ rhsm_username }}"
password: "{{ rhsm_password }}"
pool: "^{{ rhsm_pool }}$"
state: present
register: rhsm_result
until: rhsm_result is success
retries: 10
delay: 1
ignore_errors: yes
when: host_image.os == 'rhel' and "'Current' not in rhsm_status.stdout"
- name: Bootstrap ansible host
include_role:
name: ansible_host
when: inventory_hostname == 'ans.lab.local'
- name: Bootstrap cluster hosts
include_role:
name: cluster_host
when: inventory_hostname != 'ans.lab.local'
- hosts: localhost
become: no
gather_facts: no
vars_files:
- vars/environment.yml
tasks:
- name: Generate SSH script
template:
src: templates/cluster-ssh.j2
dest: "/home/{{ lookup('env','USER') }}/bin/cluster-ssh"
mode: 0774
- name: Generate startup script
template:
src: templates/cluster-up.j2
dest: "/home/{{ lookup('env','USER') }}/bin/cluster-up"
mode: 0774
- name: Generate shutdown script
template:
src: templates/cluster-down.j2
dest: "/home/{{ lookup('env','USER') }}/bin/cluster-down"
mode: 0774