Wolfgang Kulhanek
2020-01-30 046b0534b33fc6cbb278711181e3879e4473f763
commit | author | age
1874b6 1 ---
GC 2 - name: Step 003 - Create env key
3   hosts: localhost
4   connection: local
5   gather_facts: false
6   become: false
7   tags:
8   - step003
9   - generate_env_keys
10   tasks:
11   - name: Generate SSH keys
12     shell: ssh-keygen -b 2048 -t rsa -f "{{output_dir}}/{{env_authorized_key}}" -q -N ""
13     args:
14       creates: "{{output_dir}}/{{env_authorized_key}}"
e669cf 15     when: set_env_authorized_key | bool
1874b6 16
GC 17   - name: fix permission
18     file:
19       path: "{{output_dir}}/{{env_authorized_key}}"
20       mode: 0400
e669cf 21     when: set_env_authorized_key | bool
1874b6 22
GC 23   - name: Generate SSH pub key
24     shell: ssh-keygen -y -f "{{output_dir}}/{{env_authorized_key}}" > "{{output_dir}}/{{env_authorized_key}}.pub"
25     args:
26       creates: "{{output_dir}}/{{env_authorized_key}}.pub"
e669cf 27     when: set_env_authorized_key | bool
1874b6 28
GC 29 # Cloudformation template or equivalent should tag all hosts with Project:{{ env_type }}-{{ guid }}
30 - name: Configure all hosts with Repositories, Common Files and Set environment key
31   hosts:
32   - all:!windows
33   become: true
34   gather_facts: False
35   tags:
36   - step004
37   - common_tasks
38   roles:
39   - { role: "set-repositories",       when: 'repo_method is defined' }
e669cf 40   - { role: "common",                 when: 'install_common | bool' }
WK 41   - { role: "set_env_authorized_key", when: 'set_env_authorized_key | bool' }
1874b6 42
GC 43 - name: Configuring Bastion Hosts
44   hosts: bastions
45   become: true
46   roles:
e669cf 47   - { role: "bastion",              when: 'install_bastion | bool' }
WK 48   - { role: "bastion-student-user", when: 'install_student_user | bool' }
49   - { role: "bastion-opentlc-ipa",  when: 'install_ipa_client | bool' }
1874b6 50   tags:
GC 51   - step004
52   - bastion_tasks
53
046b05 54 - name: Create a Python3 VirtualEnv for use in the k8s Ansible tasks
WK 55   hosts: bastions
56   gather_facts: false
57   become: true
58   tasks:
59   - name: Setup pre-requisite python3 packages
60     package:
61       state: present
62       name:
63       - git
64       - python3-pip
65
66   - name: Setup pre-requisite pip3 packages
67     pip:
68       name:
69       - virtualenv
70       state: present
71       executable: /usr/bin/pip3
72
73   - name: Copy requirements.txt to target for k8s virtualenv
74     copy:
75       src: ./files/requirements_k8s.txt
76       dest: /tmp/requirements_k8s.txt
77
78   - name: "Create virtualenv k8s"
79     pip:
80       requirements: /tmp/requirements_k8s.txt
81       virtualenv: "/opt/virtualenvs/k8s"
82       virtualenv_site_packages: no
83       virtualenv_command: /usr/local/bin/virtualenv
84
1874b6 85 - name: PreSoftware flight-check
GC 86   hosts: localhost
87   connection: local
88   gather_facts: false
89   become: false
90   tags:
91   - flight_check
92   tasks:
93   - debug:
94       msg: "Pre-Software checks completed successfully"