This repository has been archived by the owner on Jul 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
deploy_bastion.yml
82 lines (72 loc) · 1.7 KB
/
deploy_bastion.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
70
71
72
73
74
75
76
77
78
79
80
81
82
---
- hosts: all
roles:
- admin_ssh_keys
- hosts: bastion
tasks:
- name: Install required packages
package:
name: "{{ item }}"
state: present
with_items:
- git
- ansible
- libselinux-python
# needed or ansible version check fail
- pyOpenSSL
- name: Checkout openshift-ansible
git:
repo: https://github.com/openshift/openshift-ansible.git
dest: /opt/openshift-ansible
version: openshift-ansible-3.3.35-1
- name: Create directories for holding vars
file:
name: "/etc/ansible/{{ item }}"
state: directory
with_items:
- group_vars
- group_vars/masters
- name: Copy ansible files
copy:
src: "{{ item }}"
dest: "/etc/ansible/{{ item }}"
with_items:
- hosts
- group_vars/masters/example.yml
- name: Create ssh keys
user:
name: root
generate_ssh_key: yes
register: key
- copy:
src: files/deploy.sh
dest: /usr/local/bin/deploy.sh
mode: 0755
- hosts: all
tasks:
- name: Add key to deploy
authorized_key:
user: fedora
key: "{{ hostvars['bastion']['key']['ssh_public_key'] }}"
- name: Install needed packages
dnf:
name: "{{ item }}"
state: present
with_items:
- "libsemanage-python{{ ansible_python['version']['major']}}"
- "python{{ ansible_python['version']['major']}}-dbus"
- name: Set hostname
hostname:
name: "{{ inventory_hostname }}.fosp"
- name: Copy system hosts file
template:
src: hosts.system
dest: /etc/hosts
- name:
copy:
dest: /etc/resolv.conf
content: "search fosp\nnameserver 172.25.160.20\n"
- hosts: bastion
roles:
- haproxy_bastion
- dnsmasq