All persons shall carry out and obey all ordinances passed or enacted by any town or city under the provisions of this chapter and upon neglect or refusal to comply therewith shall be subject to the penalties herein provided.