Thanks, I'll have to try that. I actually solved it where I create the 
variable. What I had in host_vars/node was:

next_part = 3

If I change it to the following it seemed to fix it.

next_part = '3'

Your solution is making use of a feature of jinja, right?

On Wednesday, November 16, 2016 at 1:10:10 PM UTC-5, Kai Stian Olstad wrote:
>
> On 15. nov. 2016 15:48, matt shepherd wrote: 
> > All, I did some searching here and did not find this specific issue. I 
> am 
> > trying to use the expect module to work with fdisk to automatically 
> > provision new space on VMs. 
> > 
> >   tasks: 
> >     - name: "DISK | Create a partition for the added disk space" 
> >       expect: 
> >         command: fdisk /dev/sda 
> >         responses: 
> >           'Command \(m for help*': 
> >             - n 
> >             - t 
> >             - w 
> >           'Select \(default.*$': p 
> >           'Partition number.*$': "{{ next_part }}" 
> >           'First sector.*$': \r 
> >           'Last sector.*$': \r 
> >           'Hex code.*$': 08e 
> > 
> > What i get is: 
> > 
> > TASK [DISK | Create a partition for the added disk space] 
> > ********************** 
> > fatal: [p-db-rhel7-01]: FAILED! => {"changed": false, "failed": true, 
> > "module_stderr": "Shared connection to XX.4.XXX.144 closed.\r\n", 
> > "module_stdout": "Traceback (most recent call last):\r\n  File 
> > \"/tmp/ansible_z0_ZP0/ansible_module_expect.py\", line 237, in 
> <module>\r\n 
> >    main()\r\n  File \"/tmp/ansible_z0_ZP0/ansible_module_expect.py\", 
> line 
> > 149, in main\r\n    response = u'%s\\n' % 
> > value.rstrip('\\n').decode()\r\nAttributeError: 'int' object has no 
> > attribute 'rstrip'\r\n", "msg": "MODULE FAILURE"} 
> > 
> > I finally figured out that the next_part variable I am passing in is the 
> > number of the partition I want to create (3 in this case), and I think 
> this 
> > is complaining because there is no "rstrip" function for integers. 
> However, 
> > I am sure peopole have used this module to great effect with responses 
> that 
> > are integers. So, any help? 
>
> You could try to filter it to a string 
> "{{ next_part | string }}" 
>
> -- 
> Kai Stian Olstad 
>

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/87c1c3f3-bbfd-4ddf-b100-1208d89dc03c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to