uberspace-ansible/roles/yourls/tasks/configuration.yml

38 lines
1.2 KiB
YAML

---
- name: copy configuration file
copy:
remote_src: yes
mode: preserve
src: ~/html/user/config-sample.php
dest: ~/html/user/config.php
- name: update database user
lineinfile:
path: ~/html/user/config.php
regexp: 'YOURLS_DB_USER'
line: define( 'YOURLS_DB_USER', '{{ uberspace_user }}' );
- name: update database password
lineinfile:
path: ~/html/user/config.php
regexp: 'YOURLS_DB_PASS'
line: define( 'YOURLS_DB_PASS', '{{ mysql_password }}' );
- name: update database name
lineinfile:
path: ~/html/user/config.php
regexp: 'YOURLS_DB_NAME'
line: define( 'YOURLS_DB_NAME', '{{ uberspace_user}}_yourls' );
- name: update domain
lineinfile:
path: ~/html/user/config.php
regexp: 'YOURLS_SITE'
line: define( 'YOURLS_SITE', 'https:/\/{{ domain }}' );
- name: set cookie key
lineinfile:
path: ~/html/user/config.php
regexp: 'YOURLS_COOKIEKEY'
line: define( 'YOURLS_COOKIEKEY', "{{ lookup('password', '/tmp/passwordfile chars=ascii_letters,digits,punctuation') }}" );
- name: set up user and password
lineinfile:
path: ~/html/user/config.php
regexp: "'username' => 'password'"
line: "'{{ yourls_user }}' => '{{ yourls_password }}'"