正文

ansible , refer system variable inside role\'s task folder examp

(2023-05-07 13:39:51) 下一个

---
- name: Hello User
  debug:
    msg: "Hello User {{ username | upper }}! You are a {{ sx }} and your fullname is {{ userfull | upper }}."
    msg: "{{ansible_env.USER}} is test_string1234 inside now"
    #msg: "test 2is {{ ansible_user }} "
  #when: "mxu_test".startswith('test')
  when:  ansible_env.USER.startswith('test')

 

##############################

if Linux user starts with string 'test; , it will show the msg:

  msg: "{{ansible_env.USER}} is test_string1234 inside now"

[ 打印 ]
阅读 ()评论 (0)
评论
目前还没有任何评论
登录后才可评论.