# reuse of paramter value inside configuration file

**URL:** <https://forum.ansible.com/t/reuse-of-paramter-value-inside-configuration-file/33054>\
**Category:** Ansible Project\
**Created:** [May 29, 2020, 8:20pm UTC](https://forum.ansible.com/t/reuse-of-paramter-value-inside-configuration-file/33054 "2020-05-29T20:20:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dudu.c](https://avatars.discourse-cdn.com/v4/letter/d/278dde/32.png) [@dudu.c](https://forum.ansible.com/u/dudu.c)\
**Post date:** [May 29, 2020, 8:20pm UTC](https://forum.ansible.com/t/reuse-of-paramter-value-inside-configuration-file/33054/1 "2020-05-29T20:20:22Z")

</div>

Hi,

I’m running a playbook that create a user on remote server and also, generate keytab file for that user based on domain properties.

I have a configuration file that holds the username , uid and some other information.

1. I wish that that keytab file will be par of the configuration and that the name of the file will be based on the provide username - **username**.keytab.

2. If I set a value of uid to start with - in my example is 2000 , can I run and index. First user 2000+1 (2001) , second user 2000+2 (2002) and etc

**Configuration file**

```auto
start_user_uid: 2000
users_keytab_location: /opt/keytab
domain: CLUSTER3.COM

user_details:
     - {username: user3 , uid: 2001 , user_domain_password: 1234@WSX , keytab_name: {{ username }}.keytab }
     - {username: user2 , uid: 2002 , user_domain_password: 1234 ,keytab_name: {{ username }}.keytab }
     - {username: user3 , uid: 2003 , user_domain_password: 1234 ,keytab_name: {{ username }}.keytab }

```

**Playbook**

```auto
- name: create user
  user:
    name: "{{ item.username }}"
    uid: "{{ item.uid }}"
  with_items: "{{ user_details }}"

- name: Generate Kerberos ticket
  expect:
    command: ktutil
    responses:
      ktutil:
        - "add_entry -password -p {{ item.username }}@{{ domain }} -k 1 -e rc4-hmac"
        - "wkt /data/ansible/add-user/{{ item.keytab_name }}.keytab"
        - "quit"
      Password: "{{ item.user_domain_password }}"
  delegate_to: localhost
  with_items: "{{ user_details }}"

```

---

<div class="post-metadata">

**Author:** ![vbotka](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/vbotka/32/359_2.png) [@vbotka](https://forum.ansible.com/u/vbotka)\
**Post date:** [May 29, 2020, 8:50pm UTC](https://forum.ansible.com/t/reuse-of-paramter-value-inside-configuration-file/33054/2 "2020-05-29T20:50:09Z")

</div>

Referencing a key in a dictionary doesn't work.  
[https://github.com/ansible/ansible/issues/50280#issuecomment-450901757](https://github.com/ansible/ansible/issues/50280#issuecomment-450901757)
