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?
Thanks
--
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/f251d050-2d13-4662-b6d3-2c752915b977%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.