正文

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)
評論
目前還沒有任何評論
登錄後才可評論.