I'm trying to run the following ansible playbook. However, I am getting an error on running it.
---
- hosts: live
remote_user: root
vars:
destination: /var/www/html/app.mytest.com/releases/{{ ansible_date_time.year }}{{ ansible_date_time.month }}{{ ansible_date_time.day }}{{ ansible_date_time.hour }}{{ ansible_date_time.minute }}{{ ansible_date_time.second }}
tasks:
- git:
repo: 'git@bitbucket:mytest/mytest.git'
dest: "{{ destination }}"
depth: 1
- name: copying .env file to remote host
copy:
src: /root/playbooks/resources/live/.env
dest: "{{ destination }}/"
- name: php artisan migrate
shell: "php {{ destination }}/artisan migrate"
- name: php artisan package:discover
shell: "php {{ destination }}/artisan package:discover"
- name: npm install
shell: "npm install"
- name: npm run dev
shell: "npm run dev"
- name: php artisan queue:restart
shell: "php {{ destination }}/artisan queue:restart"
- name: service supervisord restart
shell: "service supervisord restart"
- name: php artisan queue:flush
shell: "php {{ destination }}/artisan queue:flush"
...
The error i'm getting is as follows:
Would appreciate some help in solving this syntax error.
Indentation of tasks is wrong. Instead of
tasks:
- git:
repo: 'git@bitbucket:mytest/mytest.git'
dest: "{{ destination }}"
The correct syntax is
tasks:
- git:
repo: 'git@bitbucket:mytest/mytest.git'
dest: "{{ destination }}"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.