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
|
/playbook.retry
|
||||||
/hosts.ini
|
|
||||||
/*.json
|
/*.json
|
||||||
|
|||||||
18
README.md
18
README.md
@ -10,16 +10,11 @@ Available playbooks:
|
|||||||
+ app-start
|
+ app-start
|
||||||
+ app-stop
|
+ app-stop
|
||||||
|
|
||||||
Start by copy then change values of hosts example file :
|
First create a file `vars.json` who contain :
|
||||||
|
|
||||||
```bash
|
|
||||||
$ cp hosts.example.ini hosts.ini
|
|
||||||
```
|
|
||||||
|
|
||||||
Then create a file `vars.json` who contain :
|
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
|
"working_dir": "/home/vagrant/test",
|
||||||
"container_name": "myapp",
|
"container_name": "myapp",
|
||||||
"repository": "https://git.example.com/vendor/app.git",
|
"repository": "https://git.example.com/vendor/app.git",
|
||||||
"version": "master",
|
"version": "master",
|
||||||
@ -38,7 +33,8 @@ Then create a file `vars.json` who contain :
|
|||||||
Then run a playbook:
|
Then run a playbook:
|
||||||
|
|
||||||
```bash
|
```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
|
## Manage database
|
||||||
@ -47,10 +43,11 @@ Available playbooks:
|
|||||||
|
|
||||||
+ db-create
|
+ db-create
|
||||||
|
|
||||||
First create a file `dbvars.json` who contain :
|
First create a file `vars.json` who contain :
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
|
"ansible_python_interpreter": "/usr/bin/python3",
|
||||||
"container_name": "myappdb",
|
"container_name": "myappdb",
|
||||||
"envvars": {
|
"envvars": {
|
||||||
"MYSQL_ROOT_PASSWORD": "superpassword",
|
"MYSQL_ROOT_PASSWORD": "superpassword",
|
||||||
@ -64,5 +61,6 @@ First create a file `dbvars.json` who contain :
|
|||||||
Then run a playbook:
|
Then run a playbook:
|
||||||
|
|
||||||
```bash
|
```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
|
- name: Install app
|
||||||
hosts: webservers
|
hosts: all
|
||||||
become: yes
|
become: yes
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: Start app
|
- name: Start app
|
||||||
hosts: webservers
|
hosts: all
|
||||||
become: yes
|
become: yes
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: Start app
|
- name: Start app
|
||||||
hosts: webservers
|
hosts: all
|
||||||
become: yes
|
become: yes
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: Create mysql database
|
- name: Create mysql database
|
||||||
hosts: webservers
|
hosts: all
|
||||||
become: yes
|
become: yes
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user