Uploaded image for project: 'Product Technical Learning'
  1. Product Technical Learning
  2. PTL-16132

Unnecessary hardcoded path in ch07s09 step 5.3

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Normal Normal
    • None
    • AU294 - RHAAP2.5-en-3-20260109
    • AU294
    • None
    • False
    • Hide

      None

      Show
      None
    • False
    • en-US (English)

      Please fill in the following information:


      URL:  
      Reporter RHNID:  
      Section Title:                                                                        

      Issue description

      The task step is as follows:

      5.3. Overwrite the role's roles/apache.developer_configs/tasks/main.yml file with the
      developer_tasks.yml file in the project directory.

      The file developer_tasks.yml contains the following task:

      # Allows 'student' user to login to
      # any of the user accounts - for the lab only.
      # Jinja syntax for 'key' keyword available from the documentation.
      - name: Give student access to all accounts
        ansible.posix.authorized_key:
          user: "{{ item['username'] }}"
          state: present
          key: "{{ lookup('file', '/workspaces/roles-review/' + item['username'] + '.key.pub') }}"
        loop: "{{ web_developers }}"

      The hard-coded path is not necessary as it prevents files of being found in cases delegates are experimenting, have different directory structure or move the files to the role/files structure as implied by best practices.

      Steps to reproduce:

      Complete the exercise and run ansible-navigator outside of the dev container.

      Workaround:

      Remove the hard-coded path. Solution executes equally well inside a dev container and outside by running ansible-navigator directly on the workstation.

      i.e. replace:
          key: "{{ lookup('file', '/workspaces/roles-review/' + item['username'] + '.key.pub') }}"

      by:
          key: "{{ lookup('file', item['username'] + '.key.pub') }}"

      Expected result:

              Unassigned Unassigned
              skareiva Simonas Kareiva
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: