108 lines
2.8 KiB
YAML
108 lines
2.8 KiB
YAML
---
|
||
- name: Install rundeck
|
||
hosts: all
|
||
become: yes
|
||
vars:
|
||
- rddbname: "rundeck"
|
||
- rduser: "rundeckuser"
|
||
- rdpw: "rundeckuserpassword"
|
||
- rdhost: "rundeck"
|
||
- rdtz: "Europe/Paris"
|
||
|
||
tasks:
|
||
- name: Change TimeZone to "{{ rdtz }}"
|
||
community.general.timezone:
|
||
name: "{{ rdtz }}"
|
||
|
||
- name: Install paquets software-props curl wget vim openjdk11 python3-pymysql
|
||
package:
|
||
name:
|
||
- software-properties-common
|
||
- gpg
|
||
- curl
|
||
- wget
|
||
- vim
|
||
- openjdk-11-jre-headless
|
||
- python3-pymysql
|
||
state: present
|
||
|
||
- name: installe mariadb-server
|
||
package:
|
||
name: mariadb-server
|
||
state: present
|
||
|
||
- name: cree db "{{ rddbname }}"
|
||
community.mysql.mysql_db:
|
||
name: "{{ rddbname }}"
|
||
state: present
|
||
login_unix_socket: /var/run/mysqld/mysqld.sock
|
||
|
||
- name: Cree utilisteur {{ rduser }}
|
||
community.mysql.mysql_user:
|
||
name: "{{ rduser }}"
|
||
password: "{{ rdpw }}"
|
||
priv: "{{ rddbname }}.*:ALL"
|
||
state: present
|
||
login_unix_socket: /var/run/mysqld/mysqld.sock
|
||
|
||
# - name:
|
||
#fail:
|
||
#msg: 'fini'
|
||
|
||
- name: get key for rundeck apt repo
|
||
ansible.builtin.apt_key:
|
||
url: https://packages.rundeck.com/pagerduty/rundeck/gpgkey
|
||
state: present
|
||
|
||
- name: ajout depot
|
||
ansible.builtin.apt_repository:
|
||
repo: deb https://packages.rundeck.com/pagerduty/rundeck/any/ any main
|
||
state: present
|
||
|
||
- name: Update cache
|
||
ansible.builtin.apt:
|
||
update_cache: yes
|
||
cache_valid_time: 86400
|
||
|
||
- name: installe rundeck
|
||
package:
|
||
name: rundeck
|
||
state: present
|
||
|
||
- name: supprimie jdbc.h2
|
||
replace:
|
||
path: /etc/rundeck/rundeck-config.properties
|
||
regexp: '^\s*dataSource.url = jdbc:h2:.*'
|
||
replace: ''
|
||
backup: yes
|
||
|
||
- name: remplace localhost par {{ rdhost }} dans /etc/rundeck/framework.properties
|
||
replace:
|
||
path: /etc/rundeck/framework.properties
|
||
regexp: "localhost"
|
||
replace: "{{ rdhost }}"
|
||
backup: yes
|
||
|
||
- name: remplace localhost par {{ rdhost }} dans /etc/rundeck/rundeck-system.properties
|
||
replace:
|
||
path: /etc/rundeck/rundeck-config.properties
|
||
regexp: "^grails.serverURL=.*"
|
||
replace: "grails.serverURL=http://{{ rdhost }}:4440"
|
||
backup: yes
|
||
|
||
- name: configure DB connexion
|
||
blockinfile:
|
||
path: /etc/rundeck/rundeck-config.properties
|
||
backup: yes
|
||
block: |
|
||
dataSource.driverClassName = org.mariadb.jdbc.Driver
|
||
dataSource.url = jdbc:mysql://localhost/rundeck?autoReconnect=true&useSSL=false
|
||
dataSource.username = {{ rduser }}
|
||
dataSource.password = {{ rdpw }}
|
||
|
||
- name: Active rundeckd et le lance
|
||
ansible.builtin.sysvinit:
|
||
name: rundeckd
|
||
state: started
|
||
enabled: yes
|