mirror of
https://gitlab.sectorq.eu/jaydee/ansible.git
synced 2025-12-14 01:54:56 +01:00
build
This commit is contained in:
3
all.yml
3
all.yml
@@ -2,6 +2,9 @@
|
||||
name: Roles
|
||||
gather_facts: false
|
||||
roles:
|
||||
- name: init
|
||||
role: init
|
||||
tags: init
|
||||
- name: setup
|
||||
role: setup
|
||||
tags: setup
|
||||
|
||||
@@ -15,11 +15,23 @@ datacenter:
|
||||
ansible_python_interpreter: /usr/bin/python3
|
||||
ansible_ssh_user: jd
|
||||
# ansible_ssh_password: l4c1j4yd33Du5lo
|
||||
ansible_become_password: l4c1j4yd33Du5lo
|
||||
ansible_become_password: l4c1j4yd33Du5lo-
|
||||
identity_file: ssh_key.pem
|
||||
ansible_ssh_pass: l4c1j4yd33Du5lo
|
||||
ansible_ssh_pass: l4c1j4yd33Du5lo-
|
||||
ansible_become_user: root
|
||||
amd.home.lan:
|
||||
|
||||
external:
|
||||
hosts:
|
||||
sectorq.cloud:
|
||||
vars:
|
||||
ansible_python_interpreter: /usr/bin/python3
|
||||
ansible_ssh_user: root
|
||||
# ansible_ssh_password: l4c1j4yd33Du5lo
|
||||
ansible_become_password: l4c1j4yd33Du5lo-
|
||||
identity_file: ssh_key.pem
|
||||
ansible_ssh_pass: l4c1j4yd33Du5lo-
|
||||
ansible_become_user: root
|
||||
|
||||
nas:
|
||||
hosts:
|
||||
nas.home.lan:
|
||||
|
||||
@@ -3,7 +3,7 @@ mkdir /tmp/certgen 2>/dev/null
|
||||
cd /tmp/certgen
|
||||
|
||||
openssl genrsa -aes256 -out ca-key.pem -passout pass:"foobarpwd" 4096
|
||||
openssl req -new -x509 -days 365 -key ca-key.pem -sha256 -out ca.pem -subj "/C=SK/ST=Slovakia/L=SK/O=sectorq.eu/OU=IT/CN=sectorq.eu" -passin pass:"foobarpwd"
|
||||
openssl req -new -x509 -days 365 -key ca-key.pem -sha256 -out ca.pem -subj "/C=SK/ST=Slovakia/L=SK/O=sectorq.cloud/OU=IT/CN=sectorq.cloud" -passin pass:"foobarpwd"
|
||||
openssl genrsa -out server-key.pem 4096
|
||||
if [[ `hostname` == "nas" ]]
|
||||
then
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
mode: '0777'
|
||||
owner: jd
|
||||
group: root
|
||||
when: inventory_hostname != 'sectorq.cloud'
|
||||
|
||||
- name: Copy generated certs to files
|
||||
ansible.builtin.copy:
|
||||
@@ -63,23 +64,11 @@
|
||||
mode: '0644'
|
||||
owner: jd
|
||||
group: root
|
||||
|
||||
- name: Copy generated certs to files
|
||||
ansible.builtin.copy:
|
||||
src: /tmp/certgen/key.pem
|
||||
dest: /media/nas/data/certs/docker/{{ inventory_hostname }}
|
||||
remote_src: true
|
||||
mode: '0644'
|
||||
owner: jd
|
||||
group: root
|
||||
- name: Copy generated certs to files
|
||||
ansible.builtin.copy:
|
||||
src: /tmp/certgen/cert.pem
|
||||
dest: /media/nas/data/certs/docker/{{ inventory_hostname }}
|
||||
remote_src: true
|
||||
mode: '0644'
|
||||
owner: jd
|
||||
group: root
|
||||
when: inventory_hostname != 'sectorq.cloud'
|
||||
loop:
|
||||
- ca.pem
|
||||
- cert.pem
|
||||
- key.pem
|
||||
- name: Restart docker service
|
||||
ansible.builtin.systemd:
|
||||
name: docker
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
# update_cache: true
|
||||
- name: Install the version docker1
|
||||
ansible.builtin.apt:
|
||||
name: "{{ item }}"
|
||||
name: "{{ item }}=5:28.5.2-1~{{ ansible_distribution | lower }}.{{ ansible_distribution_major_version }}~{{ ansible_distribution_release }}"
|
||||
state: present
|
||||
when:
|
||||
- ansible_distribution == "Debian"
|
||||
@@ -191,7 +191,7 @@
|
||||
state: present
|
||||
allow_downgrade: true
|
||||
when:
|
||||
- ansible_distribution == "Debian1"
|
||||
- ansible_distribution == "Debian"
|
||||
loop:
|
||||
- containerd.io
|
||||
|
||||
@@ -201,7 +201,7 @@
|
||||
state: present
|
||||
allow_downgrade: true
|
||||
when:
|
||||
- ansible_distribution == "Debian1"
|
||||
- ansible_distribution == "Debian"
|
||||
loop:
|
||||
- docker-buildx-plugin
|
||||
|
||||
@@ -210,13 +210,7 @@
|
||||
path: /etc/systemd/system/docker.service.d/
|
||||
state: directory
|
||||
mode: '0755'
|
||||
- name: Create a directory for certs
|
||||
ansible.builtin.file:
|
||||
path: /etc/docker/certs
|
||||
state: directory
|
||||
mode: '0700'
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
|
||||
# - name: Copy files
|
||||
# ansible.builtin.copy:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
- name: Setup
|
||||
become: "{{ 'no' if inventory_hostname == 'nas.home.lan' else 'yes' }}"
|
||||
become: "{{ 'no' if inventory_hostname in ['sectorq.cloud', 'nas.home.lan'] else 'yes' }}"
|
||||
block:
|
||||
- name: Gather facts
|
||||
ansible.builtin.setup:
|
||||
|
||||
Reference in New Issue
Block a user