I have run the playbook command with the -vvvv flag and it is giving me
this error
[root@gefela ansible_junos]# ansible-playbook -i inventory junos_config.yml
--check -vvvv
ansible-playbook 2.9.5
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules',
'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.6/site-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 3.6.8 (default, Oct 11 2019, 15:04:54) [GCC 8.3.1
20190507 (Red Hat 8.3.1-4)]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /home/gefela/ansible_junos/inventory as it did
not pass its verify_file() method
script declined parsing /home/gefela/ansible_junos/inventory as it did not
pass its verify_file() method
auto declined parsing /home/gefela/ansible_junos/inventory as it did not
pass its verify_file() method
Parsed /home/gefela/ansible_junos/inventory inventory source with ini plugin
Loading callback plugin default of type stdout, v2.0 from
/usr/lib/python3.6/site-packages/ansible/plugins/callback/default.py
PLAYBOOK: junos_config.yml
*******************************************************************************************************************************
Positional arguments: junos_config.yml
verbosity: 4
connection: smart
timeout: 10
become_method: sudo
tags: ('all',)
check: True
inventory: ('/home/gefela/ansible_junos/inventory',)
forks: 5
1 plays in junos_config.yml
PLAY [Juniper SRX configuration compliance checks]
*******************************************************************************************************
META: ran handlers
TASK [Syslog server check]
*******************************************************************************************************************************
task path: /home/gefela/ansible_junos/junos_config.yml:9
<172.16.203.121> attempting to start connection
<172.16.203.121> using connection plugin netconf
<172.16.203.121> local domain socket does not exist, starting it
<172.16.203.121> control socket path is /root/.ansible/pc/3e04c18d96
<172.16.203.121> local domain socket listeners started successfully
<172.16.203.121> loaded netconf plugin junos from path
/usr/lib/python3.6/site-packages/ansible/plugins/netconf/junos.py for
network_os junos
<172.16.203.121>
<172.16.203.121> local domain socket path is /root/.ansible/pc/3e04c18d96
<172.16.203.121> ESTABLISH LOCAL CONNECTION FOR USER: gefela
<172.16.203.121> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo
/root/.ansible/tmp/ansible-local-10845_kx_3k77/ansible-tmp-1586683874.2918632-239315467988226
`" && echo ansible-tmp-1586683874.2918632-239315467988226="` echo
/root/.ansible/tmp/ansible-local-10845_kx_3k77/ansible-tmp-1586683874.2918632-239315467988226
`" ) && sleep 0'
<172.16.203.121> Attempting python interpreter discovery
<172.16.203.121> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command
-v '"'"'/usr/bin/python'"'"'; command -v '"'"'python3.7'"'"'; command -v
'"'"'python3.6'"'"'; command -v '"'"'python3.5'"'"'; command -v
'"'"'python2.7'"'"'; command -v '"'"'python2.6'"'"'; command -v
'"'"'/usr/libexec/platform-python'"'"'; command -v
'"'"'/usr/bin/python3'"'"'; command -v '"'"'python'"'"'; echo ENDFOUND &&
sleep 0'
<172.16.203.121> Python interpreter discovery fallback (pipelining support
required for extended interpreter discovery)
Using module file
/usr/lib/python3.6/site-packages/ansible/modules/network/junos/junos_config.py
<172.16.203.121> PUT
/root/.ansible/tmp/ansible-local-10845_kx_3k77/tmps4qg_pli TO
/root/.ansible/tmp/ansible-local-10845_kx_3k77/ansible-tmp-1586683874.2918632-239315467988226/AnsiballZ_junos_config.py
<172.16.203.121> EXEC /bin/sh -c 'chmod u+x
/root/.ansible/tmp/ansible-local-10845_kx_3k77/ansible-tmp-1586683874.2918632-239315467988226/
/root/.ansible/tmp/ansible-local-10845_kx_3k77/ansible-tmp-1586683874.2918632-239315467988226/AnsiballZ_junos_config.py
&& sleep 0'
<172.16.203.121> EXEC /bin/sh -c '/usr/bin/python
/root/.ansible/tmp/ansible-local-10845_kx_3k77/ansible-tmp-1586683874.2918632-239315467988226/AnsiballZ_junos_config.py
&& sleep 0'
<172.16.203.121> EXEC /bin/sh -c 'rm -f -r
/root/.ansible/tmp/ansible-local-10845_kx_3k77/ansible-tmp-1586683874.2918632-239315467988226/
> /dev/null 2>&1 && sleep 0'
[WARNING]: Platform linux on host 172.16.203.121 is using the discovered
Python interpreter at /usr/bin/python, but future installation of another
Python
interpreter could change this. See
https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html
for more information.
fatal: [172.16.203.121]: FAILED! => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"module_stderr": "",
"module_stdout": "\n{\"msg\": \*"FileNotFoundError(2*, 'No such file or
directory')\", \"failed\": true, \"exception\": \"WARNING: The below
traceback may *not* be related to the actual failure.\\n File
\\\"/tmp/ansible_junos_config_payload_BA_i4F/ansible_junos_config_payload.zip/ansible/module_utils/network/junos/junos.py\\\",
line 97, in get_capabilities\\n capabilities =
Connection(module._socket_path).get_capabilities()\\n File
\\\"/tmp/ansible_junos_config_payload_BA_i4F/ansible_junos_config_payload.zip/ansible/module_utils/connection.py\\\",
line 185, in __rpc__\\n raise ConnectionError(to_text(msg,
errors='surrogate_then_replace'), code=code)\\n\", \"invocation\":
{\"module_args\": {\"comment\": \"Appropriate Syslog server configured\",
\"username\": null, \"provider\": null, \"backup_options\": null,
\"rollback\": null, \"timeout\": null, \"src\": null, \"confirm\": 0,
\"lines\": [\"set system syslog archive size 300000\", \"set system syslog
archive files 3\", \"set system syslog archive world-readable\", \"set
system syslog user * any emergency\", \"set system syslog host
192.168.100.70 any any\", \"set system syslog host 192.168.100.70
interactive-commands any\", \"set system syslog host 192.168.100.70
facility-override local1\", \"set system syslog host 192.168.100.70
log-prefix firewall\", \"set system syslog host 192.168.100.70
source-address \\\"172.16.203.121\\\"\", \"set system syslog host
192.168.100.70 explicit-priority\", \"set system syslog file messages any
critical\", \"set system syslog file messages authorization info\", \"set
system syslog file default-log-messages structured-data\", \"set system
syslog file sessions user info\", \"set system syslog file
interactive-commands interactive-commands error\"], \"update\": \"merge\",
\"replace\": null, \"confirm_commit\": false, \"host\": null, \"zeroize\":
false, \"src_format\": null, \"ssh_keyfile\": null, \"check_commit\":
false, \"password\": null, \"backup\": false, \"port\": null,
\"transport\": null}}}\n\n{\"msg\": \"FileNotFoundError(2, 'No such file or
directory')\", \"failed\": true, \"exception\": \"WARNING: The below
traceback may *not* be related to the actual failure.\\n File
\\\"/tmp/ansible_junos_config_payload_BA_i4F/ansible_junos_config_payload.zip/ansible/module_utils/network/junos/junos.py\\\",
line 97, in get_capabilities\\n capabilities =
Connection(module._socket_path).get_capabilities()\\n File
\\\"/tmp/ansible_junos_config_payload_BA_i4F/ansible_junos_config_payload.zip/ansible/module_utils/connection.py\\\",
line 185, in __rpc__\\n raise ConnectionError(to_text(msg,
errors='surrogate_then_replace'), code=code)\\n\", \"invocation\":
{\"module_args\": {\"comment\": \"Appropriate Syslog server configured\",
\"username\": null, \"provider\": null, \"backup_options\": null,
\"rollback\": null, \"timeout\": null, \"src\": null, \"confirm\": 0,
\"lines\": [\"set system syslog archive size 300000\", \"set system syslog
archive files 3\", \"set system syslog archive world-readable\", \"set
system syslog user * any emergency\", \"set system syslog host
192.168.100.70 any any\", \"set system syslog host 192.168.100.70
interactive-commands any\", \"set system syslog host 192.168.100.70
facility-override local1\", \"set system syslog host 192.168.100.70
log-prefix firewall\", \"set system syslog host 192.168.100.70
source-address \\\"172.16.203.121\\\"\", \"set system syslog host
192.168.100.70 explicit-priority\", \"set system syslog file messages any
critical\", \"set system syslog file messages authorization info\", \"set
system syslog file default-log-messages structured-data\", \"set system
syslog file sessions user info\", \"set system syslog file
interactive-commands interactive-commands error\"], \"update\": \"merge\",
\"replace\": null, \"confirm_commit\": false, \"host\": null, \"zeroize\":
false, \"src_format\": null, \"ssh_keyfile\": null, \"check_commit\":
false, \"password\": null, \"backup\": false, \"port\": null,
\"transport\": null}}}\n",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
PLAY RECAP
*****************************************************************************************************************
I cannot seem to find why it is complaining about this \
*"FileNotFoundError(2*, 'No such file or directory')\
On Mon, Mar 9, 2020 at 4:16 PM Stefan Hornburg (Racke) <[email protected]>
wrote:
> On 3/9/20 4:36 PM, gefela wrote:
> >
> > I am trying to run a playbook and the details come from a file but it
> is giving me an error message
> >
> >
> > ansible-playbook -i inventory junos_config.yml
> >
> > PLAY [Juniper SRX configuration compliance checks]
> *****************************
> >
> > TASK [Syslog server check]
> *****************************************************
> > fatal: [172.16.203.121]: FAILED! => {"msg": "FileNotFoundError(2, 'No
> such file or directory')"}
> >
> > PLAY RECAP
> *********************************************************************
> > 172.16.203.121 : ok=0 changed=0 unreachable=0
> failed=1 skipped=0 rescued=0 ignored=0
>
> I have no clue about Juniper and the junos_config module, but it might be
> worth to run with -vvvv to see where
> Ansible looks for the file.
>
> Regards
> Racke
>
> >
> > This is the yaml file
> >
> > ---
> >
> > - name: Juniper SRX configuration compliance checks
> > hosts: juniper
> > gather_facts: false
> > tasks:
> > - name: Syslog server check
> > junos_config:
> > src: files/syslog_config
> > src_format: set
> > comment: Appropriate Syslog server configured
> > register: junos_output
> > - debug:
> > var: junos_output
> >
> > - name: print success
> > debug:
> > msg: Syslog server check - This check has passed with the
> following output({{ junos_output }})
> > when: not junos_output.changed
> >
> > - name: print failed
> > debug:
> > msg: Syslog server check - This check has failed with the
> following output({{ junos_output }})
> > when: junos_output.changed
> >
> >
> > - name: Admin credentials
> > junos_config:
> > src: files/admin_user
> > comment: admin user created and confirmed
> >
> >
> > - name: NTP check
> > junos_config:
> > src: files/NTP server
> > comment: correct NTP server
> >
> > - name: idle timeout check
> > junos_config:
> > src: files/idle timeout
> > comment: idle timeout confirmed
> >
> >
> >
> > The structure of syslog file is
> > cat files/syslog_config
> > set system syslog archive size 300000
> > set system syslog archive files 3
> > set system syslog archive world-readable
> > set system syslog user * any emergency
> > set system syslog host 192.168.100.70 any any
> > set system syslog host 192.168.100.70 interactive-commands any
> > set system syslog host 192.168.100.70 facility-override local1
> > set system syslog host 192.168.100.70 log-prefix firewall
> > set system syslog host 192.168.100.70 source-address "{{
> inventory_hostname }}"
> > set system syslog host 192.168.100.70 explicit-priority
> > set system syslog file messages any critical
> > set system syslog file messages authorization info
> > set system syslog file default-log-messages structured-data
> > set system syslog file sessions user info
> > set system syslog file interactive-commands interactive-commands error
> >
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Ansible Project" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to
> > [email protected] <mailto:
> [email protected]>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/ansible-project/605b2514-739a-4281-93da-f4f437b368a8%40googlegroups.com
> > <
> https://groups.google.com/d/msgid/ansible-project/605b2514-739a-4281-93da-f4f437b368a8%40googlegroups.com?utm_medium=email&utm_source=footer
> >.
>
>
> --
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/ajP7IiMAX1M/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/887f2651-793a-d073-17cc-37a6f86396dc%40linuxia.de
> .
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAKTknnjmn03pRro0Ct%3D9mRRqNfT9DGRmzBBrFn62bij53pWg8g%40mail.gmail.com.