refs #8414 - Refactor extract playbook variables and secrets everywhere in TV Screen

This commit is contained in:
Xavi Lleó 2025-01-24 14:49:49 +01:00
parent 89c18a0e6d
commit 4d70766a41
4 changed files with 17 additions and 57 deletions

View File

@ -62,13 +62,13 @@
command: mount -a command: mount -a
when: fstab.changed when: fstab.changed
- name: Set MariaDB Cron to /etc/cron.d # - name: Set MariaDB Cron to /etc/cron.d
template: # template:
src: templates/cron_mariadb # src: templates/cron_mariadb
dest: /etc/cron.d/vn # dest: /etc/cron.d/vn
owner: root # owner: root
group: root # group: root
mode: u=rw,g=r,o=r # mode: u=rw,g=r,o=r
- name: Insert MySQL certificates - name: Insert MySQL certificates
copy: copy:
@ -80,14 +80,6 @@
loop: "{{ certificates }}" loop: "{{ certificates }}"
notify: restart-mariadb notify: restart-mariadb
- name: Configure MySQL master cert
copy:
content: "{{ lookup(passbolt, 'private_mysql', folder_parent_id=passbolt_folder).description }}"
dest: /etc/mysql/key.pem
owner: mysql
group: mysql
mode: u=rw,g=,o=
- when: production is true - when: production is true
block: block:
- name: Set MariaDB custom configuration Production - name: Set MariaDB custom configuration Production
@ -125,41 +117,14 @@
- "files/mariaconfigfiles/z92-testing.cnf" - "files/mariaconfigfiles/z92-testing.cnf"
notify: restart-mariadb notify: restart-mariadb
# - name: Extracting passwords # - name: Set MariaBackup custom configuration Test
# no_log: true # template:
# set_fact: # src: "apply.config-test.sh"
# jenkins_token: "{{ lookup(passbolt, jenkins_user_name, folder_parent_id=passbolt_folder).password }}" # dest: /root/mariabackup/apply.config.sh
# owner: root
# - name: Debug variable # group: root
# debug: # mode: u=rw,g=r,o=r
# msg: "{{ jenkins_token }}"
- name: Set MariaBackup custom configuration Test
template:
src: "apply.config-test.sh"
dest: /root/mariabackup/apply.config.sh
owner: root
group: root
mode: u=rw,g=r,o=r
- name: Extracting dbusername
set_fact:
dbusername: "{{ lookup(passbolt, dbuser, folder_parent_id=passbolt_folder).username }}"
- name: Extracting dbpassword
no_log: true
set_fact:
dbpass: "{{ lookup(passbolt, dbuser, folder_parent_id=passbolt_folder).password }}"
- name: Extracting MariaBackup UserName
set_fact:
mariabackupusernametpl: "{{ lookup(passbolt, mariabackupusername, folder_parent_id=passbolt_folder).username }}"
- name: Extracting MariaBackup Password
no_log: true
set_fact:
mariabackuppasstpl: "{{ lookup(passbolt, mariabackupusername, folder_parent_id=passbolt_folder).password }}"
- name: Set MariaBackup custom template configuration Test - name: Set MariaBackup custom template configuration Test
template: template:
src: "{{ item }}" src: "{{ item }}"
@ -168,7 +133,7 @@
group: root group: root
mode: u=rw,g=,o= mode: u=rw,g=,o=
with_items: with_items:
- "apply.cnf" - "test-db/apply.config.sh"
- "my.cnf" - "my.cnf"
- name: Set MariaDB local configuration file - name: Set MariaDB local configuration file

View File

@ -1,5 +0,0 @@
[client]
host = localhost
user = {{ dbusername }}
password = {{ dbpass }}
socket = /var/run/mysqld/mysqld.sock

View File

@ -1,7 +1,7 @@
[mariabackup] [mariabackup]
host = localhost host = localhost
user = {{ mariabackupusernametpl }} user = mariabackup
password = {{ mariabackuppasstpl }} password = {{ lookup(passbolt, 'mariabackup', folder_parent_id=passbolt_folder).password }}
use-memory = 1G use-memory = 1G
parallel = 2 parallel = 2
stream = mbstream stream = mbstream