invalid literal for int() in Ansible -
when run code below, there error. why happen? can value {{ ssh.port }}
or {{ ssh.port|int }}
, when replace {{ ssh.port|int }}
10022
, works.
$ ansible-playbook -i staging site.yml
error! unexpected exception: invalid literal int() base 10: '{{ssh.port|int}}'
# staging [webservers] ip_address [all:vars] env=staging # site.yml - include: webservers.yml # webservers.yml - hosts: webservers remote_user: deploy port: "{{ssh.port|int}}" become: true gather_facts: false vars_files: - group_vars/credentials/{{ env }} roles: - common # group_vars/all.yml ssh: port: 10022
ansible: 2.1.0.0, mac: 10.11.5
this possible bug. error occurs here.
play attributes not yet templated here , int() throws error.
but i'd advice use ansible_port: 10022
variable in group_vars/all.yml
file achieve want. automatically set ssh port value.
or may patch play_context.py
remove int() – work, don't know possible drawbacks.
Comments
Post a Comment