Created
October 5, 2017 13:39
-
-
Save halberom/859118d6da28493e17ad806e6b44e24c to your computer and use it in GitHub Desktop.
ansible - type is not maintained, even with |int
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TASK [Gathering Facts] ********************************************************************************************************************************************************************************************************************************************************* | |
ok: [localhost] | |
TASK [debug] ******************************************************************************************************************************************************************************************************************************************************************* | |
ok: [localhost] => { | |
"ansible_memtotal_mb": 16384 | |
} | |
TASK [command] ***************************************************************************************************************************************************************************************************************************************************************** | |
changed: [localhost] | |
TASK [debug] ******************************************************************************************************************************************************************************************************************************************************************* | |
ok: [localhost] => { | |
"mem": { | |
"changed": true, | |
"cmd": "echo 12345", | |
"delta": "0:00:00.007038", | |
"end": "2017-10-05 14:37:32.778004", | |
"failed": false, | |
"rc": 0, | |
"start": "2017-10-05 14:37:32.770966", | |
"stderr": "", | |
"stderr_lines": [], | |
"stdout": "12345", | |
"stdout_lines": [ | |
"12345" | |
] | |
} | |
} | |
TASK [set_fact] **************************************************************************************************************************************************************************************************************************************************************** | |
ok: [localhost] | |
TASK [debug] ******************************************************************************************************************************************************************************************************************************************************************* | |
ok: [localhost] => { | |
"ansible_memtotal_mb": "12345" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: localhost | |
gather_facts: True | |
connection: local | |
tasks: | |
- debug: | |
var: ansible_memtotal_mb | |
- shell: echo 12345 | |
register: mem | |
- debug: | |
var: mem | |
- set_fact: | |
ansible_memtotal_mb: "{{ mem.stdout|int }}" | |
- debug: | |
var: ansible_memtotal_mb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment