--- - 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" |