Passage du nom du host en CLI.
This commit is contained in:
parent
9bc7732ed3
commit
1335619a5f
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,2 @@
|
||||
/playbook.retry
|
||||
/hosts.ini
|
||||
/*.json
|
||||
|
||||
18
README.md
18
README.md
@ -10,16 +10,11 @@ Available playbooks:
|
||||
+ app-start
|
||||
+ app-stop
|
||||
|
||||
Start by copy then change values of hosts example file :
|
||||
|
||||
```bash
|
||||
$ cp hosts.example.ini hosts.ini
|
||||
```
|
||||
|
||||
Then create a file `vars.json` who contain :
|
||||
First create a file `vars.json` who contain :
|
||||
|
||||
```json
|
||||
{
|
||||
"working_dir": "/home/vagrant/test",
|
||||
"container_name": "myapp",
|
||||
"repository": "https://git.example.com/vendor/app.git",
|
||||
"version": "master",
|
||||
@ -38,7 +33,8 @@ Then create a file `vars.json` who contain :
|
||||
Then run a playbook:
|
||||
|
||||
```bash
|
||||
$ ansible-playbook -i hosts.ini -e @vars.json playbooks/app-install.yml
|
||||
HOSTNAME=vps.example.com
|
||||
$ ansible-playbook -i $HOSTNAME, -e ansible_python_interpreter=/usr/bin/python3 -e @vars.json playbooks/app-install.yml
|
||||
```
|
||||
|
||||
## Manage database
|
||||
@ -47,10 +43,11 @@ Available playbooks:
|
||||
|
||||
+ db-create
|
||||
|
||||
First create a file `dbvars.json` who contain :
|
||||
First create a file `vars.json` who contain :
|
||||
|
||||
```json
|
||||
{
|
||||
"ansible_python_interpreter": "/usr/bin/python3",
|
||||
"container_name": "myappdb",
|
||||
"envvars": {
|
||||
"MYSQL_ROOT_PASSWORD": "superpassword",
|
||||
@ -64,5 +61,6 @@ First create a file `dbvars.json` who contain :
|
||||
Then run a playbook:
|
||||
|
||||
```bash
|
||||
$ ansible-playbook -i hosts.ini -e @dbvars.json playbooks/db-create.yml
|
||||
HOSTNAME=vps.example.com
|
||||
$ ansible-playbook -i $HOSTNAME, -e ansible_python_interpreter=/usr/bin/python3 -e @vars.json playbooks/db-create.yml
|
||||
```
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
[webservers]
|
||||
example.com
|
||||
|
||||
[webservers:vars]
|
||||
ansible_python_interpreter=/usr/bin/python3
|
||||
|
||||
working_dir=/var/apps
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: Install app
|
||||
hosts: webservers
|
||||
hosts: all
|
||||
become: yes
|
||||
|
||||
tasks:
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: Start app
|
||||
hosts: webservers
|
||||
hosts: all
|
||||
become: yes
|
||||
|
||||
tasks:
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: Start app
|
||||
hosts: webservers
|
||||
hosts: all
|
||||
become: yes
|
||||
|
||||
tasks:
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: Create mysql database
|
||||
hosts: webservers
|
||||
hosts: all
|
||||
become: yes
|
||||
|
||||
tasks:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user