Skip to content

Commit 34d2ad9

Browse files
authored
Fix some idempotence bugs (#1)
Allow to run role again after initial installation
1 parent b574930 commit 34d2ad9

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Role is self sustainable - it installs all needed prerequisites on the target no
88

99
## Role Variables
1010

11-
Available variables are listed below along with their default values:
11+
Available variables are listed below along with their default values. Please generate an app key with `php artisan key:generate --show` and replace `snipe_app_key`.
1212

1313
```yaml
1414
#if you want to purge all php, nginx, apache2 installation and configuration change it to true
@@ -21,6 +21,7 @@ snipe_domain: localhost
2121
snipe_environment: production
2222
snipe_debug_mode: false
2323
snipe_http_server: nginx
24+
snipe_app_key: ChangeMe
2425

2526
#default db settings
2627
snipe_db_host: localhost

defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ snipe_environment: production
77
snipe_debug_mode: false
88
snipe_log_debug_mode: warning
99
snipe_http_server: nginx
10+
snipe_app_key: ChangeMe
1011
snipe_db_host: localhost
1112
snipe_db_port: 3306
1213
snipe_db_name: snipeit

tasks/host_bootstrap.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
- name: Host Bootstrap | Install prerequisites
22
apt:
3-
name: [software-properties-common, git, debconf-utils, unzip]
3+
name: [software-properties-common, git, debconf-utils, unzip, curl]
44
state: present
55
become: true
66

@@ -49,7 +49,8 @@
4949
apt:
5050
name: [default-mysql-server, python3-mysqldb]
5151
state: present
52-
become: true
52+
become: true
53+
register: mysqlinstall
5354

5455
- name: Set MySQL root Password
5556
become: True
@@ -60,6 +61,7 @@
6061
login_user: "root"
6162
login_password: ""
6263
state: present
64+
when: mysqlinstall.changed
6365

6466
- name: Host Bootstrap | Mysql | Create database
6567
mysql_db:

tasks/snipeit_install.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,8 @@
4848
chdir: "{{ snipe_install_dir }}"
4949
creates: "{{ snipe_install_dir }}/vendor"
5050
warn: no
51-
become: true
52-
53-
- name: Snipe install | Generate app_key
54-
command: php artisan key:generate --force
55-
args:
56-
chdir: "{{ snipe_install_dir }}"
57-
warn: no
51+
environment:
52+
COMPOSER_ALLOW_SUPERUSER: 1
5853
become: true
5954

6055
- name: Snipe install | Clear cached config

templates/dotenv.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# --------------------------------------------
44
APP_ENV={{snipe_environment}}
55
APP_DEBUG={{snipe_debug_mode}}
6-
APP_KEY=ChangeMe
6+
APP_KEY={{snipe_app_key}}
77
APP_URL=http://{{snipe_domain}}
88
APP_TIMEZONE='UTC'
99
APP_LOCALE=en

0 commit comments

Comments
 (0)