Ansible Playbook syntax check issue
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
-1
down vote
favorite
i have below detail in /etc/ansible/hosts
[dev] 10.13.212.32
and i am able ping this hosts as below:
# ansible dev -m ping
Output:
[root@localhost ~]# ansible dev -m ping
10.13.212.32 | SUCCESS => {
"changed": false,
"ping": "pong"
when i check syntax of *.yml file .
# ansible-playbook --syntax-check --list-tasks -i hosts ./nginx.yml
or
# ansible-playbook nginx.yml --check**
[WARNING]: Unable to parse /root/hosts as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
ERROR! Syntax Error while loading YAML.
did not find expected '-' indicator
The error appears to have been in '/root/nginx.yml': line 3, column 1, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: install and start nginx
hosts: localhost
^ here
help me out with the issue.
centos ansible
add a comment |Â
up vote
-1
down vote
favorite
i have below detail in /etc/ansible/hosts
[dev] 10.13.212.32
and i am able ping this hosts as below:
# ansible dev -m ping
Output:
[root@localhost ~]# ansible dev -m ping
10.13.212.32 | SUCCESS => {
"changed": false,
"ping": "pong"
when i check syntax of *.yml file .
# ansible-playbook --syntax-check --list-tasks -i hosts ./nginx.yml
or
# ansible-playbook nginx.yml --check**
[WARNING]: Unable to parse /root/hosts as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
ERROR! Syntax Error while loading YAML.
did not find expected '-' indicator
The error appears to have been in '/root/nginx.yml': line 3, column 1, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: install and start nginx
hosts: localhost
^ here
help me out with the issue.
centos ansible
can u check the host declaration?
â SivaPrasath
Aug 3 at 10:50
add a comment |Â
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
i have below detail in /etc/ansible/hosts
[dev] 10.13.212.32
and i am able ping this hosts as below:
# ansible dev -m ping
Output:
[root@localhost ~]# ansible dev -m ping
10.13.212.32 | SUCCESS => {
"changed": false,
"ping": "pong"
when i check syntax of *.yml file .
# ansible-playbook --syntax-check --list-tasks -i hosts ./nginx.yml
or
# ansible-playbook nginx.yml --check**
[WARNING]: Unable to parse /root/hosts as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
ERROR! Syntax Error while loading YAML.
did not find expected '-' indicator
The error appears to have been in '/root/nginx.yml': line 3, column 1, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: install and start nginx
hosts: localhost
^ here
help me out with the issue.
centos ansible
i have below detail in /etc/ansible/hosts
[dev] 10.13.212.32
and i am able ping this hosts as below:
# ansible dev -m ping
Output:
[root@localhost ~]# ansible dev -m ping
10.13.212.32 | SUCCESS => {
"changed": false,
"ping": "pong"
when i check syntax of *.yml file .
# ansible-playbook --syntax-check --list-tasks -i hosts ./nginx.yml
or
# ansible-playbook nginx.yml --check**
[WARNING]: Unable to parse /root/hosts as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
ERROR! Syntax Error while loading YAML.
did not find expected '-' indicator
The error appears to have been in '/root/nginx.yml': line 3, column 1, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: install and start nginx
hosts: localhost
^ here
help me out with the issue.
centos ansible
edited Aug 3 at 10:48
SivaPrasath
3,27511333
3,27511333
asked Aug 3 at 10:40
Govinda Chaulagain
1914
1914
can u check the host declaration?
â SivaPrasath
Aug 3 at 10:50
add a comment |Â
can u check the host declaration?
â SivaPrasath
Aug 3 at 10:50
can u check the host declaration?
â SivaPrasath
Aug 3 at 10:50
can u check the host declaration?
â SivaPrasath
Aug 3 at 10:50
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
The error is exactly what is says, there is no /root/hosts
file!
ansible-playbook --syntax-check --list-tasks -i hosts ./nginx.yml
With the -i
switch (--inventory-file
), you are pointing to the file /root/hosts
(since you are running as root
, from root
's $HOME
) instead of the file:
/etc/ansible/hosts
So, try again with:
ansible-playbook --syntax-check --list-tasks -i /etc/ansible/hosts ./nginx.yml
And your playbook fails due to incorrect syntax and indentation. Check this example for starters.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
The error is exactly what is says, there is no /root/hosts
file!
ansible-playbook --syntax-check --list-tasks -i hosts ./nginx.yml
With the -i
switch (--inventory-file
), you are pointing to the file /root/hosts
(since you are running as root
, from root
's $HOME
) instead of the file:
/etc/ansible/hosts
So, try again with:
ansible-playbook --syntax-check --list-tasks -i /etc/ansible/hosts ./nginx.yml
And your playbook fails due to incorrect syntax and indentation. Check this example for starters.
add a comment |Â
up vote
0
down vote
The error is exactly what is says, there is no /root/hosts
file!
ansible-playbook --syntax-check --list-tasks -i hosts ./nginx.yml
With the -i
switch (--inventory-file
), you are pointing to the file /root/hosts
(since you are running as root
, from root
's $HOME
) instead of the file:
/etc/ansible/hosts
So, try again with:
ansible-playbook --syntax-check --list-tasks -i /etc/ansible/hosts ./nginx.yml
And your playbook fails due to incorrect syntax and indentation. Check this example for starters.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
The error is exactly what is says, there is no /root/hosts
file!
ansible-playbook --syntax-check --list-tasks -i hosts ./nginx.yml
With the -i
switch (--inventory-file
), you are pointing to the file /root/hosts
(since you are running as root
, from root
's $HOME
) instead of the file:
/etc/ansible/hosts
So, try again with:
ansible-playbook --syntax-check --list-tasks -i /etc/ansible/hosts ./nginx.yml
And your playbook fails due to incorrect syntax and indentation. Check this example for starters.
The error is exactly what is says, there is no /root/hosts
file!
ansible-playbook --syntax-check --list-tasks -i hosts ./nginx.yml
With the -i
switch (--inventory-file
), you are pointing to the file /root/hosts
(since you are running as root
, from root
's $HOME
) instead of the file:
/etc/ansible/hosts
So, try again with:
ansible-playbook --syntax-check --list-tasks -i /etc/ansible/hosts ./nginx.yml
And your playbook fails due to incorrect syntax and indentation. Check this example for starters.
edited Aug 3 at 11:25
answered Aug 3 at 11:12
maulinglawns
4,9081821
4,9081821
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f460295%2fansible-playbook-syntax-check-issue%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
can u check the host declaration?
â SivaPrasath
Aug 3 at 10:50