On 09.01.2020 18:32, Masudur Rahman wrote:
> - name: Change Umask to 0022 to make installer working
> shell: umask 0022 && umask
>
> - name: Generic question with multiple different responses
> expect:
> echo: yes
> command: ./{{ version }} --mode text --disable_glibcxx_version_check 1
> chdir: /home/app/installers/
As Brian mention, thing set it one task is not propagated to the next.
umask is a built in shell feature and the expect module is Python with no way of setting umask.
So you have a least two alternatives, setting the umask before running ansible-playbook or use bash/sh to execute the command in expect.
command: bash -c "umask 0022; ./{{ version }} --mode text --disable_glibcxx_version_check 1"
> responses:
> Question:
> 'Please choose an option': '2'
> '\[\/opt\/app\]': '\n'
> 'Backup Directory \[\/opt\/app\]': '/home/app/backup/'
> 'Password ': 'Password'
> 'Do you want to continue\? \[Y\/n\]': 'y'
>
This will not work, question is the actual key in you dict and not a parameter you can use with expect.
Correct code would be:
responses:
'Please choose an option': '2'
'\[\/opt\/app\]': '\n'
'Backup Directory \[\/opt\/app\]': '/home/app/backup/'
'Password ': 'Password'
'Do you want to continue\? \[Y\/n\]': 'y'
--
Kai Stian Olstad