title: I'm trying to unseal vault using ansible. But I'm getting connection refused error
body: <p>It worked a few days back, i even checked similar problems like <a href="https://stackoverflow.com/questions/36193952/how-to-connect-to-vault-server">here</a>
  I tried to add the environment variables and everything, my hcl file aslo is not a problem as far as i know</p>
  
  <p>hcl file is</p>
  
  <pre><code>storage "file" {
  path = "/home/***/vault/"
  }
  
  listener "tcp" {
  address = "127.0.0.1:8200"
  tls_disable = 1
  }
  
  </code></pre>
  
  <p>my unseal.yml looks like this</p>
  
  <pre><code>---
  - name: Removing login and putting to another file
    shell: sed -n '7p' keys.txt &gt; login.txt
  
  - name: Remove all lines other than the keys
    shell: sed '6,$d' keys.txt &gt; temp.txt
  
  - name: Extracting the keys 
    shell: cut -c15- temp.txt &gt; unseal_keys.txt
  
  - name: Deleting unnecessary files
    shell: rm temp.txt
  
  - name: Unsealing the vault
    environment: 
      VAULT_ADDR: http://127.0.0.1:8200
    shell: vault operator unseal $(awk 'NR==1' unseal_keys.txt)
  
  - name: Unsealing the vault
    environment: 
      VAULT_ADDR: http://127.0.0.1:8200
    shell: vault operator unseal $(awk 'NR==2' unseal_keys.txt)
  
  - name: Unsealing the vault
    environment: 
      VAULT_ADDR: http://127.0.0.1:8200
    shell: vault operator unseal $(awk 'NR==3' unseal_keys.txt)
    register: check
  
  - debug: var=check.stdout_lines
  
  - name: Login
    environment: 
      VAULT_ADDR: http://127.0.0.1:8200
    shell: vault login $(sed 's/Initial Root Token://; s/ //' login.txt)
    register: checkLogin
  
  - debug: var=checkLogin.stdout_lines
  </code></pre>
  
  <p>My start-server.yml looks like this</p>
  
  <pre><code>---
  #- name: Disable mlock 
  #  shell: sudo setcap cap_ipc_lock=+ep $(readlink -f $(which vault))
  #  shell: LimitMEMLOCK=infinity
  
  - name: Start vault service
    systemd:
      state: started
      name: vault
      daemon_reload: yes
    environment: 
      VAULT_ADDR: http://127.0.0.1:8200
    become: true
  
  - pause:
      seconds: 15
  </code></pre>
  
  <p>This the error shown.</p>
  
  <pre><code>fatal: [europa]: FAILED! =&gt; {"changed": true, "cmd": "vault operator unseal $(awk 'NR==1' unseal_keys.txt)", "delta": "0:00:00.049258", "end": "2019-09-17 12:25:48.987789", "msg": "non-zero return code", "rc": 2, "start": "2019-09-17 12:25:48.938531", "stderr": "Error unsealing: Put http://127.0.0.1:8200/v1/sys/unseal: dial tcp 127.0.0.1:8200: connect: connection refused", "stderr_lines": ["Error unsealing: Put http://127.0.0.1:8200/v1/sys/unseal: dial tcp 127.0.0.1:8200: connect: connection refused"], "stdout": "", "stdout_lines": []}
  </code></pre>
  
  <p>This is the main error</p>
  
  <pre><code>"Error unsealing: Put http://127.0.0.1:8200/v1/sys/unseal: dial tcp 127.0.0.1:8200: connect: connection refused", "stderr_lines": ["Error unsealing: Put http://127.0.0.1:8200/v1/sys/unseal: dial tcp 127.0.0.1:8200: connect: connection refused"
  </code></pre>